faApp.controller('InfoManageFeedBackCtrl',['$scope','infoManageService','$location','$controller','$route',function($scope,infoManageService,$location,$controller,$route) {   
	
  $controller('BaseListCtrl', {$scope: $scope}); 

  $scope.fbs = [];
  $scope.loading = true;
  $scope.showCon = false;

  $scope.$watch('config',function(){
    infoManageService.fbList($scope.config).then(function(json){
      $scope.fbs = json.list;
      $scope.pager = json.pager;
      $scope.loading = false;
    });
  },true);

  $scope.config = {
    "pageSize" : 20,
    "pageNo" : 1
  };
  
 $scope.showDiv = function(id){
    angular.forEach($scope.fbs,function(o){
      if(o.id==id){
        // $scope.showContent=o.fpContents;
        // $scope.showContent=o.fpContents.replace("＜","<").replace("＞",">");
        var c = o.fpContents.replace("＜","<").replace("＞",">");
        $("#showContent").html(c);
        $scope.showCon=true;
      }
    });
  };  
}]);

faApp.controller('InfoManageBankCardCtrl',['$scope','infoManageService','$location','$controller','$route',function($scope,infoManageService,$location,$controller,$route) {   
  $controller('BaseListCtrl', {$scope: $scope});  

  $scope.bcs = [];
  $scope.loading = true;

  $scope.search = function(){
    $scope.config = $scope.searchMap;
  }

  $scope.$watch('config',function(){
    infoManageService.bcList($scope.config).then(function(json){
      $scope.bcs = json.list;
      $scope.pager = json.pager;
      $scope.loading = false;
    });
  },true)

  $scope.config = {
    "pageSize" : 20,
    "pageNo" : 1
  };  
}]);

faApp.controller('InfoManageWithdrawCtrl',['$scope','infoManageService','$location','$controller','$route',function($scope,infoManageService,$location,$controller,$route) {   
  $controller('BaseListCtrl', {$scope: $scope}); 

  $scope.withdraws = [];
  $scope.loading = true;

  $scope.search = function(){
    $scope.config = $scope.searchMap;
  }

  $scope.config = {
    "pageSize" : 20,
    "pageNo" : 1
  };

  $scope.$watch('config',function(){
    if(!$scope.config.withdrawStatus){
      $scope.config.withdrawStatus = "";
    }
    $scope.config.pageSize = 20;
    infoManageService.withdrawList($scope.config).then(function(json){
      $scope.withdraws = json.list;
      $scope.pager = json.pager;
      $scope.loading = false;
    });
  },true);
}]);

faApp.controller('InfoManageWithdrawDetailCtrl',['$scope','infoManageService','$location','$controller','$route','$routeParams',function($scope,infoManageService,$location,$controller,$route,$routeParams) {   
  $controller('BaseCtrl', {$scope: $scope}); 

  $scope.withdraw = {};
  $scope.id = $routeParams.id;
  $scope.canEdit = false;

  if($scope.id){
    infoManageService.withdrawDetail($scope.id).then(function(json){
      $scope.withdraw = json.dto;
      if($scope.withdraw.withdrawStatus && $scope.withdraw.withdrawStatus == '01'){
        $scope.canEdit = true;
      }
    });
  }

  $scope.save = function(){
    infoManageService.withdrawUpdate($scope.withdraw).then(function(json){
      if (json.statusCode){
          alert(json.statusCode);
        }else{
          $route.reload();
        }
    });
  }
}]);

faApp.controller('InfoManageWithPayRunningCtrl',['$scope','infoManageService','$location','$controller','$route','$routeParams',function($scope,infoManageService,$location,$controller,$route,$routeParams) {   
  $controller('BaseListCtrl', {$scope: $scope}); 
  $scope.config.pageSize = 10;
  $scope.$watch('config', function(json) {   
    infoManageService.payRunningList($scope.config).then(function(json){
      $scope.withdraws = json.list;
      $scope.pager = json.pager;
    });
  }, true);
}]);

faApp.controller('InfoManageWithDrawAskForCtrl',['$scope','infoManageService','$location','$controller','$route',function($scope,infoManageService,$location,$controller,$route) {   
  $controller('BaseListCtrl', {$scope: $scope}); 

  $scope.withdraws = [];
  $scope.payMoneyCheck = false;
  $scope.transferAcoutsFail = false;
  $scope.failReson =  '';


  $scope.search = function(){
    $scope.config = $scope.searchMap;
  }

  $scope.config = {
    "pageSize" : 10,
    "pageNo" : 1
  };

  $scope.$watch('config',function(){
    infoManageService.askForList($scope.config).then(function(json){
      $scope.withdraws = json.result;
      $scope.pager = json.pager;
    });
  },true);

  $scope.showHide = function(v,index){
    $scope.param = {
      'id' : $scope.withdraws[index].id,
      'platSerialNo' : $scope.withdraws[index].platSerialNo
    };
    if(v == '1'){
      $scope.payMoneyCheck = true;
      $scope.listIndex = index || 0;

    }else{
      $scope.transferAcoutsFail = true;
    }
  }
  $scope.submit = function(stg) {
    if(stg){
      if( !$scope.failReson) {
        alert('请填写失败原因');
        return;
      }else{
        $scope.param.remark = $scope.failReson;
        console.log($scope.param);
        infoManageService.askForFail($scope.param).then(function(json) {
          if (json.statusCode) {
            alert('出错了' + json.statusCode)
          } else {
            $route.reload();
          }
        })
      }
    }else{
      console.log($scope.param);
      infoManageService.askForSuccess($scope.param).then(function(json) {
        if (json.statusCode) {
          alert('出错了' + json.statusCode)
        } else {
          $route.reload();
        }
      })
    }
  };
}]);

faApp.controller('InfoManageWithDrawAskForDetailCtrl',['$scope','$routeParams','infoManageService','$location','$controller','$route',function($scope,$routeParams,infoManageService,$location,$controller,$route) {   
  $controller('BaseCtrl', {$scope: $scope}); 

  $scope.id = $routeParams.id;
  console.log($scope.id);
  infoManageService.askForDetail($scope.id).then(function(json){
    $scope.withdraws = json.payList;
  })
}]);